package br.gov.ibama.client.componentes;

import java.util.ArrayList;
import java.util.List;

import com.smartgwt.client.widgets.form.fields.RadioGroupItem;

public class RadioGroupItemBasis extends RadioGroupItem {

	private List<String> lista = new ArrayList<String>();

	public RadioGroupItemBasis() {
		configuraRadio();
	}

	public RadioGroupItemBasis(String name, String title) {
		super(name, title);
		configuraRadio();
	}

	public void configuraRadio() {
		this.setWidth("100%");
		this.setWrap(true);
		this.setWrapTitle(true);
	}

	public void setObrigatorio() {
		this.setRequired(true);
		this.setRequiredMessage(BasisConstantes.MSG_OBRIGATORIO);
		this.setCellStyle("_obrigatorio");
	}

	public void carregaItens() {
		this.setValueMap(getLista().toArray(new String[getLista().size()]));
	}

	public void adicionaItens(String title) {
		getLista().add(title);
	}

	public List<String> getLista() {
		return lista;
	}

	public void setLista(List<String> lista) {
		this.lista = lista;
	}

}
